package com.bsth.entity.schedule;

import com.bsth.entity.CarPark;
import com.bsth.entity.Line;
import com.bsth.entity.Station;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;

/**
 * 时刻表明细
 */
@Entity
@Table(name = "bsth_c_s_ttinfo_detail")
@NamedEntityGraphs({
        @NamedEntityGraph(name = "tTInfoDetail_xl_lp_qdz_zdz_tcc", attributeNodes = {
                @NamedAttributeNode("xl"),
                @NamedAttributeNode("ttinfo"),
                @NamedAttributeNode("lp"),
                @NamedAttributeNode("qdz"),
                @NamedAttributeNode("zdz"),
                @NamedAttributeNode("tcc")
        })
})
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
public class TTInfoDetail extends BEntity {

    /** 主健Id */
    @Id
    @GeneratedValue
    private Long id;


    /** 关联线路 */
    @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private Line xl;
    /** 时刻表主对象关联 */
    @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private TTInfo ttinfo;
    /** 关联的路牌 */
    @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private GuideboardInfo lp;

    /** 发车顺序号 */
    @Column(nullable = false)
    private Integer fcno;
    /** 线路方向（TODO：上下行，上行，下行，这个以后用枚举还是字典再议，现在先用文字） */
    @Column(nullable = false)
    private String xlDir;

    /** 起点站关联（以后不用了，暂时留着） */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private Station qdz;
    /** 终点站关联（以后不用了，暂时留着） */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private Station zdz;
    /** 停车场关联（出场，进场班次会关联停车场）（以后不用了，暂时留着） */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    private CarPark tcc;

    // 站点包括普通站点和停车场（站点编码不同，使用站点编码区分）
    // 以后不需要再区分是站点还是停车场了
    /** 起站点代码（bsth_c_station，bsth_c_car_park 里的编码） */
    private String qdzCode;
    /** 起站点名字（bsth_c_stationroute，bsth_c_car_park里的名字） */
    private String qdzName;
    /** 终点站代码（bsth_c_station，bsth_c_car_park 里的编码） */
    private String zdzCode;
    /** 终点站名字（bsth_c_stationroute，bsth_c_car_park里的名字） */
    private String zdzName;

    /** 发车时间（格式 HH:mm） */
    @Column(nullable = false, length = 5)
    private String fcsj;
    /** 对应班次数 */
    private Integer bcs;
    @Column(nullable = false)
    /** 计划里程 */
    private Double jhlc;
    /** 班次历时 */
    private Integer bcsj;

    /** 班次类型 字典type=ScheduleType */
    @Column(nullable = false)
    private String bcType;

    /** 是否分班（表示这个班次是否是晚班班次，就是换另外一个驾驶员开）*/
    private Boolean isFB;

    /** 是否切换线路 */
    private Boolean isSwitchXl;
    /** 切换的线路（isSwitchXl == true） */
    @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
    private Line switchXl;
    /** 切换线路信息（isSwitchXl == true） */
    private String switchXlDesc;
    /** 备注 */
    private String remark;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Line getXl() {
        return xl;
    }

    public void setXl(Line xl) {
        this.xl = xl;
    }

    public TTInfo getTtinfo() {
        return ttinfo;
    }

    public void setTtinfo(TTInfo ttinfo) {
        this.ttinfo = ttinfo;
    }

    public GuideboardInfo getLp() {
        return lp;
    }

    public void setLp(GuideboardInfo lp) {
        this.lp = lp;
    }

    public Integer getFcno() {
        return fcno;
    }

    public void setFcno(Integer fcno) {
        this.fcno = fcno;
    }

    public String getXlDir() {
        return xlDir;
    }

    public void setXlDir(String xlDir) {
        this.xlDir = xlDir;
    }

    public Station getQdz() {
        return qdz;
    }

    public void setQdz(Station qdz) {
        this.qdz = qdz;
    }

    public Station getZdz() {
        return zdz;
    }

    public void setZdz(Station zdz) {
        this.zdz = zdz;
    }

    public String getFcsj() {
        return fcsj;
    }

    public void setFcsj(String fcsj) {
        this.fcsj = fcsj;
    }

    public Integer getBcs() {
        return bcs;
    }

    public void setBcs(Integer bcs) {
        this.bcs = bcs;
    }

    public Double getJhlc() {
        return jhlc;
    }

    public void setJhlc(Double jhlc) {
        this.jhlc = jhlc;
    }

    public Integer getBcsj() {
        return bcsj;
    }

    public void setBcsj(Integer bcsj) {
        this.bcsj = bcsj;
    }

    public String getBcType() {
        return bcType;
    }

    public void setBcType(String bcType) {
        this.bcType = bcType;
    }

    public Boolean getIsSwitchXl() {
        return isSwitchXl;
    }

    public void setIsSwitchXl(Boolean isSwitchXl) {
        this.isSwitchXl = isSwitchXl;
    }

    public Line getSwitchXl() {
        return switchXl;
    }

    public void setSwitchXl(Line switchXl) {
        this.switchXl = switchXl;
    }

    public String getSwitchXlDesc() {
        return switchXlDesc;
    }

    public void setSwitchXlDesc(String switchXlDesc) {
        this.switchXlDesc = switchXlDesc;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public CarPark getTcc() {
        return tcc;
    }

    public void setTcc(CarPark tcc) {
        this.tcc = tcc;
    }

    public Boolean getIsFB() {
        return isFB;
    }

    public void setIsFB(Boolean isFB) {
        this.isFB = isFB;
    }

    public String getQdzCode() {
        return qdzCode;
    }

    public void setQdzCode(String qdzCode) {
        this.qdzCode = qdzCode;
    }

    public String getQdzName() {
        return qdzName;
    }

    public void setQdzName(String qdzName) {
        this.qdzName = qdzName;
    }

    public String getZdzCode() {
        return zdzCode;
    }

    public void setZdzCode(String zdzCode) {
        this.zdzCode = zdzCode;
    }

    public String getZdzName() {
        return zdzName;
    }

    public void setZdzName(String zdzName) {
        this.zdzName = zdzName;
    }
}
